Skip to content

[peppy-alsa] Read DoP levels instead of a constant#23

Open
Gjuju wants to merge 1 commit into
moode-player:mainfrom
Gjuju:feat/peppy-dop-levels
Open

[peppy-alsa] Read DoP levels instead of a constant#23
Gjuju wants to merge 1 commit into
moode-player:mainfrom
Gjuju:feat/peppy-dop-levels

Conversation

@Gjuju

@Gjuju Gjuju commented Jul 21, 2026

Copy link
Copy Markdown

Problem

On a DSD source played as DoP, the meter sits at a constant 4/100 and the needles
never move. PCM is fine.

DoP is not a conversion, it is an encapsulation: 16 DSD bits travel in the low bits of
a 24-bit word, under an alternating 0x05/0xFA marker byte. The s16 scope hands the
plugin the top 16 bits of that word — so what the plugin measures as an amplitude
is the marker, which alternates between two fixed values. Hence a constant reading.

Fix

Those same top 16 bits also carry the first 8 DSD bits of every frame, and in a
sigma-delta stream the local density of ones is the amplitude (50% = silence).
Counting them recovers the envelope. No change anywhere else: same passive tap, same
FIFO format, spectrum untouched, no new dependency.

A DoP stream is recognised by the marker alternation over 64 frames; everything else
falls through to the existing peak path, so PCM is bit-for-bit unaffected.

Three things beyond the raw decode, each needed for the needle to read like the PCM
path does:

  • peak, not RMS — the PCM path returns the peak of the period, so this does too,
    over a short sliding window. Returning an RMS made the same music read lower and
    duller than PCM.
  • DSD full scale is a 50% modulation index — a full-scale signal's density swings
    25%↔75%, not 0↔100%. Referring to the full range under-reads everything by 6 dB.
  • group length sets the measurement bandwidth — the modulator's shaped noise is
    ultrasonic and enormous; a wide measurement window puts it on the needle as a floor
    that never falls. Groups are sized from snd_pcm_meter_get_rate() so the bandwidth,
    not just the response time, is identical from DSD64 to DSD512.

Out of scope

Native DSD is unchanged and still unsupported: there the s16 scope cannot convert
at all and asserts (pcm_meter.c:1222) before the plugin sees a sample. This patch
neither fixes nor worsens that. The meter requires DoP on DSD sources.

Testing

Verified with a set of the same master in FLAC 96/192/352
kHz and DSD64/128/256 — needles track DoP and reach comparable levels to the FLAC
versions. Ballistics were tuned against a synthetic plucked-string envelope with a
known true level, and the scale checked against known amplitudes (full scale reads
100, silence 0, linear in between).

Package revision bumped to 1moode2 so the rebuilt package supersedes the installed one.

@Gjuju
Gjuju marked this pull request as draft July 21, 2026 18:19
@Gjuju
Gjuju marked this pull request as ready for review July 21, 2026 20:15
@moodeaudio

Copy link
Copy Markdown
Contributor

Interesting enhancement. Testing will have to be postponed until after 10.3.1 ships because there's a need to get the RB and other bug fixes out to users asap.

@Gjuju

Gjuju commented Jul 21, 2026

Copy link
Copy Markdown
Author

I agree on 10.3.1.

This one is also a PR at peppyalsa and, I hope, could perhaps be merged soon.

I also pushed 2 PR on alsa-lib to also get a waorking DSD native.
Those 2 could take ages to be released in debian ...

It works really nice and seeing my hw volume DAC working with peppy on DSD on moOde without error is awesome !

@moodeaudio

Copy link
Copy Markdown
Contributor

You have to set MPD to DoP for this right?
The "Format" field in MPD Config.

@Gjuju

Gjuju commented Jul 21, 2026

Copy link
Copy Markdown
Author

Yes, exactly.
Only DoP is supported in this PR.

If you want to get full support on native DSD you have to build alsa-lib the same way.
do you want a patch PR like this one for alsa-lib ?

@moodeaudio

Copy link
Copy Markdown
Contributor

I have to consider the maintenance responsibility when it comes to supporting patched libs because in the future it can come back to bite!

You are referring to this PR, correct? Hopefully the peppy dev will test it out.
project-owner/peppyalsa#5

@Gjuju

Gjuju commented Jul 21, 2026

Copy link
Copy Markdown
Author

Yes peppyalsa #5 is the one who makes DoP working in peppy

I made a patch build for alsa-lib to make DSD native working.
I will push a new PR and you do what you want with it.

@moodeaudio

Copy link
Copy Markdown
Contributor

Sure, no prob.

On a DSD source played as DoP the meter sits at a constant 4/100 and the needles
never move. DoP is not a conversion but an encapsulation: 16 DSD bits travel in
the low bits of a 24-bit word under an alternating 0x05/0xFA marker. The s16
scope hands the plugin the top 16 bits of that word, so what it currently
measures as an amplitude is the marker byte, which is why the reading is
constant.

Those top 16 bits also carry the first 8 DSD bits of every frame, and in a
sigma-delta stream the local density of ones IS the amplitude. Counting them
recovers the envelope, so the needles work on DoP with no change anywhere else -
same passive tap, same FIFO, spectrum untouched.

The patch recognises a DoP stream by the marker alternation and falls back to the
existing peak path for everything else, so PCM is bit-for-bit unaffected.

Native DSD is out of scope and unchanged: there the s16 scope cannot convert at
all and asserts before the plugin sees a sample.

Verified on x86 (Debian 13, USB DAC) against a set of the same master in FLAC
96/192/352 and DSD64/128/256.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Gjuju
Gjuju force-pushed the feat/peppy-dop-levels branch from 9b54f8f to 92b6b7f Compare July 23, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants